package com.wbcs.jbsf.auth.interceptor;

import java.util.List;

import com.wbcs.config.Config;
import com.wbcs.config.component.application.report.ReportBean;
import com.wbcs.system.ReportRequest;
import com.wbcs.system.assistant.ReportDataAssistant;

public class ItprHandleTreeNodeUrl extends ItprTree
{
    @Override
	public Object afterLoadData(ReportRequest rrequest,ReportBean rbean,Object typeObj,Object dataObj){
        //为wbcs情况的节点产生特定的URL，http情况的URL正常保留
        List<?> lstData = (List<?>)dataObj;
        for(Object item:lstData)
        {
        	Object url = ReportDataAssistant.getInstance().getColValue(rrequest,rbean.getId(),"uri",item);
            if(url == null || "".equals(String.valueOf(url).trim())){//url字段没有赋值
                Object code = ReportDataAssistant.getInstance().getColValue(rrequest,rbean.getId(),"code",item);
                //String prjname = Config.webroot;
                String reportUrl = Config.showreport_url;
                String wbcsurl = new StringBuffer("").append(reportUrl).append("?PAGEID=").append(code).toString();
                ReportDataAssistant.getInstance().setColValue(rrequest,rbean.getId(),"uri",item,wbcsurl);
            }else{
                String prjname = Config.webroot;
                ReportDataAssistant.getInstance().setColValue(rrequest,rbean.getId(),"uri",item,prjname + url.toString());
            }
        }
        return super.afterLoadData(rrequest,rbean,typeObj,dataObj);
    }
}

